package com.texaco.chapasFutbol.menu;

import org.andengine.engine.camera.Camera;
import org.andengine.entity.scene.menu.MenuScene;
import org.andengine.entity.scene.menu.MenuScene.IOnMenuItemClickListener;
import org.andengine.entity.scene.menu.item.IMenuItem;
import org.andengine.entity.scene.menu.item.TextMenuItem;

import com.texaco.chapasFutbol.R;
import com.texaco.chapasFutbol.entidades.Game;

public class ExitGameMenu extends ChapasMenuScene implements IOnMenuItemClickListener {

	private static final int OPTION_EXIT = 0;
	private static final int OPTION_CANCEL = 1;
	
	public ExitGameMenu(Game game, Camera camera){
		super(game, camera);

		/*
		 * Menu Item Leave Online
		 */
		final TextMenuItem miExit = getMenuItem(OPTION_EXIT, R.string.tMenuItemExit);
		this.addMenuItem(miExit);

		/*
		 * Menu Item Leave Online
		 */
		final TextMenuItem miCancel = getMenuItem(OPTION_CANCEL, R.string.tMenuItemCancel);
		this.addMenuItem(miCancel);
		
		this.buildAnimations();
		this.setBackgroundEnabled(false);
		this.setOnMenuItemClickListener(this);
	}

	public boolean onOptionSelected(MenuScene pMenuScene, IMenuItem pMenuItem,
			float pMenuItemLocalX, float pMenuItemLocalY) {
		boolean done = true;

		switch (pMenuItem.getID()) {
		case OPTION_EXIT:
			game.getActivity().finish();
			this.postActivateHud(false);
			// this.back();
			break;

		case OPTION_CANCEL:
			// this.back();
			break;

		default:
			done = false;
			break;
		}

		return done;
	}
}
